﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="nethosp_test.aspx.cs" Inherits="yy.nethosp.nethosp.pages.nethosp_test" %>
<!doctype html>
<html>
<head runat="server">
    <title>接口测试</title>
<script language="Javascript" src="/jscript/jquery.min.js"></script>
</head>
<body>
    <form id="formTest" runat="server">
    <table>
        <tr>
            <td>处方号：</td>
            <td><asp:TextBox ID="txtPrescriptionId" Text="1000876" runat="server" Width="600px"></asp:TextBox></td>
        </tr>
        <tr>
            <td>入参：</td>
            <td>
            <asp:TextBox ID="txtParams" runat="server" Width="600px" Rows="5" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align:center">
                <asp:Button ID="btnStockCheckForSearch" runat="server" Text="检查库存" 
                    onclick="btnStockCheckForSearch_Click" />
                &nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="btnPrescriptionSync" runat="server" Text="同步处方" />
                &nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="btnCancelPrescriptionSync" runat="server" Text="取消已同步处方" />
            </td>
        </tr>
    </table>
    </form>
<script language="javascript">
    $(document).ready(function () {
        $("#btnPrescriptionSync").click(function () {
            $.ajax({
                async: false,
                //url: "http://localhost:8080/nethosp/service/nethosp_interface.ashx",
                //data: { "orgid": "010001001002", "actid": "dopressync", "order_id": $('#txtPrescriptionId').val(), "rand": Math.random() },
                url: "https://zz.nxk520.com/nethosp/service/nethosp_interface.ashx",
                data: { "orgid": "440004999", "actid": "dopressync", "order_id": $('#txtPrescriptionId').val(), "rand": Math.random() },
                dataType: "json",
                type: "GET",
                beforeSend: function () {//开始loading
                    $('#btnPrescriptionSync').attr("disabled", true);
                },
                success: function (res) {
                    console.log(res)
                    $('#txtParams').val(res.code + '-----' + res.msg);
                },
                error: function (e) {
                    console.log(e);
                },
                complete: function () {//结束loading
                    $('#btnPrescriptionSync').attr("disabled", false);
                }
            });
          return false;
        });

        $("#btnCancelPrescriptionSync").click(function () {
            $.ajax({
                async: false,
                url: "https://zz.nxk520.com/nethosp/service/nethosp_interface.ashx",
                data: { "orgid": "440004999", "actid": "cxpressync", "order_id": $('#txtPrescriptionId').val(), "rand": Math.random() },
                dataType: "json",
                type: "GET",
                beforeSend: function () {//开始loading
                    $('#btnCancelPrescriptionSync').attr("disabled", true);
                },
                success: function (res) {
                    console.log(res)
                    $('#txtParams').val(res.code + '-----' + res.msg);
                },
                error: function (e) {
                    console.log(e);
                },
                complete: function () {//结束loading
                    $('#btnCancelPrescriptionSync').attr("disabled", false);
                }
            });
          return false;
        });
    });
</script>
</body>
</html>
